package com.project.internship.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.project.internship.entity.Bases;
import com.project.internship.entity.Role;
import com.project.internship.entity.Teacher;
import com.project.internship.entity.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author author
 * @since 2020-04-15
 */
@Repository
public interface UserMapper extends BaseMapper<User> {

    User loadUserByUsername(String username);

    List<Role> getUserRolesById(Integer roleId);

    IPage<User> getBaseUsers(Page<User> page, @Param("departmentId") Integer departmentId, @Param("keyword") String keyword);

    List<Bases> getNonBasesName(Integer departmentId);

    List<Teacher> getNonTeacherName(Integer departmentId);

    IPage<User> getTeacherUsers(Page<User> page,@Param("departmentId") Integer departmentId,@Param("keyword") String keyword);

    List<User> getAllotBaseUser(@Param("teacherId") Integer teacherId, @Param("year") String year);

    List<User> getAllotTeacherUser(@Param("baseId") Integer baseId, @Param("year") String year);
}
